import type { TablePaginationConfig } from "ant-design-vue"
import type { IBase, IUser, IProduct, IOrder } from "./request"

export type Transform<T> = {
  [K in keyof T]: {
    text: string,
    value: T[K] extends number ? (K extends 'del' | 'sex' | 'online' ? boolean : T[K]) : T[K]
  }
}

export type TransformValueOf<T extends Transform<any>> = {
  [K in keyof T]: T[K]['value']
}

export type PaginationConfig = TablePaginationConfig & {
  title?: string
}

export type TransformBase = Transform<IBase>

export type TransformUser = Transform<IUser>
export type TransformValueOfUser = TransformValueOf<TransformUser>

export type TransformProduct = Transform<IProduct>
export type TransformValueOfProduct = TransformValueOf<TransformProduct>

export type TransformOrder = Transform<IOrder>